[mirrors]
http://luajit.org/download/LuaJIT-2.0.3.tar.gz

[vars]
filesize=844927
sha512=7b3e3de22ac3602299b5918b60801e45a3278e547a15c16fdae7359538d4ada27ba664935d5f97c7409f330c2f8efeaae9ea03415f5e9d5a9d81e022cd5d36e0

[deps]

[build]
sed -i 's,export PREFIX=,-include config.mak #,' Makefile
echo "export PREFIX = $butch_prefix" > config.mak
echo "export DESTDIR = $butch_install_dir" >> config.mak
make CFLAGS=-D_GNU_SOURCE Q= -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install

dest="$butch_install_dir""$butch_prefix"

if [ -n "$LUAJIT_REPLACE_LUA" ] ; then

mkdir -p "$dest"/include/lua
( cd "$dest"/include/luajit-2.0/
  for i in *.h ; do
	ln -sf ../luajit-2.0/"$i" "$dest"/include/lua/
  done
)

ln -s libluajit-5.1.so.2.0.2 "$dest"/lib/liblua.so
ln -s libluajit-5.1.a "$dest"/lib/liblua.a
ln -s libluajit-5.1.so.2.0.2 "$dest"/lib/libluajit-5.1.so.2
ln -s libluajit-5.1.so.2.0.2 "$dest"/lib/libluajit-5.1.so

cat << EOF > "$dest"/lib/pkgconfig/lua.pc
majver=5
minver=1
relver=0
version=\${majver}.\${minver}.\${relver}
abiver=5.1

prefix=$butch_prefix
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
libname=lua
includedir=\${prefix}/include/lua

INSTALL_LMOD=\${prefix}/share/lua/\${abiver}
INSTALL_CMOD=${prefix}/lib/lua/${abiver}

Name: lua
Description: Just-in-time compiler for Lua
URL: http://luajit.org
Version: \${version}
Requires:
Libs: -L\${libdir} -l\${libname}
Libs.private: -Wl,-E -lm -ldl
Cflags: -I\${includedir}

EOF

fi
